

console.log("-------------------------------------------");

//声明常量的格式;
const S = '诺克萨斯';


//如果强行给它赋值则会产生报错;
//S = '稻草人';
//const声明常量.js:8 Uncaught TypeError: Assignment to constant variable.
//at const声明常量.js:8:3


//1.一定要赋初始值,不然就会报错;
//const A;
//const声明常量.js:9 Uncaught SyntaxError: Missing initializer in const declaratio


//2.一般常量要用大写;


//3.块级作用域
{
  const B = 'cc';
  console.log(B);
}
//如果把变量放在代码块的外面就会报错
//console.log(B);
//const声明常量.js:22 Uncaught ReferenceError: B is not defined
//at const声明常量.js:22:13

//4.对于数组和对象的元素修改,不算做对常量的修改,不会报错;
const TEAM = [ 'cc','dd','白虎'];
TEAM.push('奥利奥');
console.log(TEAM);